<template>
  <div class="logistics">
    <Title></Title>
    <div class="logistics_box">
      <div class="inner">
        <div class="logisticstit">
          <span>{{logisticsarr.order_logistics_name}}</span>
          <span>{{logisticsarr.order_logistics_number}}</span>
        </div>
        {{logisticsarr.length}}
        <div class="logisticsnone" v-if="logisticsarr.logistics.length==0">
           暂无物流信息
        </div>
        <el-timeline v-else>
          <el-timeline-item v-for="(item, index) in logisticsarr.logistics" :key="index" :color="index==0?'red':''" :timestamp="item.time">
            {{item.context}}
            <span style="color:red;">
              {{item.status}}
            </span>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    orderdetailapi
  } from "../../api/http.js"
  import Title from "../../components/title.vue"
  export default {
    name: 'logistics',
    components: {
      Title
    },
    data() {
      return {
        logisticsarr: []
      }
    },
    async created() {
      console.log(this.$route.query);
      const res = await orderdetailapi({
        order_id: this.$route.query.order_id
      })
      if (res.data.code == 200) {
        console.log(res.data.data.order);
        this.logisticsarr = res.data.data.order
      } else {

      }
    }
  }
</script>

<style lang="less">
.logistics_box{
   width: 100%;
  .inner{
    width: 1300px;
    margin: 0 auto;
    padding: 10px 85px;
    box-sizing: border-box;
    .logisticstit{
      width: 100%;
      height: 40px;
      border: 1px solid #CCCDCE;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      margin-bottom: 20px;
      span{
       padding: 0 20px;
       &:nth-of-type(2){
         color: red;
       }
      }
    }
    .logisticsnone{
       width: 100%;
      height: 200px;
      border: 1px solid #CCCDCE;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: #F3F3F3;
    }
  }
}
</style>
